Dynomotion

Group: DynoMotion Message: 13063 From: mljh Date: 4/4/2016
Subject: How to pick up where I left off...

So the back story...


In late 2014 I decide to use KFLOP to control a Grizzly G0602 lathe I was converting to CNC. This was my 5th CNC conversion (all the others used Mach3 and various hardware). The original stepper drivers I bought were not compatible with KFLOP so I returned them and got the KSTEP. In parallel to the mechanical build of the lathe, I dug into KFLOP programming and at one point actually was able to get my steppers to move.


Then I got stalled:

I had also converted to a VFD AC motor so I can control the spindle speed. I wanted to add an encoder so I can use this lathe for threading. I've converted a mini lathe with an encoder, a Gecko G540 and Mach3 and it was simple. After several weeks of research, private emails and public posts, I finally hit a wall and couldn't find a path forward. I was stalled and time slipped by...


Until now. Now I need to get this larger lathe operational for a new project. I started digging out everything. I had not finished mounting the KFLOP/KSTEP in my control box because I was waiting for a Winford breakout board. Another reason the project stalled. 


I'm trying to decide if I should push through this and try to figure out how to get KFLOP working without an encoder and deal with it later. I see that even as of today, folks are asking questions about and struggling with encoders. If I decide to push forward without an encoder, where should I start? Should I pickup with the 1+ year old version of firmware and software or update to the latest and greatest before re-engaging? My KFLOP is a REV 1.3 and KSTEP REV 1.2. Are these still the current version? If not, will the latest firmware/software work with them?


Thanks in advance,

Michael



Group: DynoMotion Message: 13064 From: Moray Cuthill Date: 4/4/2016
Subject: Re: How to pick up where I left off...
Hi Michael,

I'm sure if you post up what the specific problems you have are, then somebody will be able to point you in the right direction.

I'd start by downloading the Release version 4.33 of KMotion/CNC (note 4.33 is the Release Version, and all the other 4.33 version with a suffixed letter were the pre-release versions). It doesn't matter what revision your boards are, as I think the revisions were only minor electronics changes, which don't affect the firmware/software.

I've got a lathe, and I'll admit controlling the spindle has been a problem, but it is doable, provided you have it fitted with a suitable quadrature encoder (or a setup that will produce a quadrature signal - i.e. you could use a slotted disc with two offset optos)

Moray

On Mon, Apr 4, 2016 at 6:06 PM, mhackney@... [DynoMotion] <DynoMotion@yahoogroups.com> wrote:
 

So the back story...


In late 2014 I decide to use KFLOP to control a Grizzly G0602 lathe I was converting to CNC. This was my 5th CNC conversion (all the others used Mach3 and various hardware). The original stepper drivers I bought were not compatible with KFLOP so I returned them and got the KSTEP. In parallel to the mechanical build of the lathe, I dug into KFLOP programming and at one point actually was able to get my steppers to move.


Then I got stalled:

I had also converted to a VFD AC motor so I can control the spindle speed. I wanted to add an encoder so I can use this lathe for threading. I've converted a mini lathe with an encoder, a Gecko G540 and Mach3 and it was simple. After several weeks of research, private emails and public posts, I finally hit a wall and couldn't find a path forward. I was stalled and time slipped by...


Until now. Now I need to get this larger lathe operational for a new project. I started digging out everything. I had not finished mounting the KFLOP/KSTEP in my control box because I was waiting for a Winford breakout board. Another reason the project stalled. 


I'm trying to decide if I should push through this and try to figure out how to get KFLOP working without an encoder and deal with it later. I see that even as of today, folks are asking questions about and struggling with encoders. If I decide to push forward without an encoder, where should I start? Should I pickup with the 1+ year old version of firmware and software or update to the latest and greatest before re-engaging? My KFLOP is a REV 1.3 and KSTEP REV 1.2. Are these still the current version? If not, will the latest firmware/software work with them?


Thanks in advance,

Michael




Group: DynoMotion Message: 13066 From: mljh Date: 4/4/2016
Subject: Re: How to pick up where I left off...
Thanks Moray, it's the "suitable quadrature encoder" that was the primary issue. The only one I could find even close to my price range was over $400. And frankly, at that price I'm tempted to scrap the KFLOP and go a different direction. I found an email thread from Tom that said that they hadn't written code to work with a single pulse per revolution, has that been address now? If not, the solution was to use 2 photo transistors mounted 1/4 of a slot pitch apart. I don't have time or desire to design my own encoder from scratch, that is just not a good use of my time. If I had an encoder that is known to work (and not $$$) then I probably could pick it up from there. 

Other than that, the other source of friction was just the entire configuration/coding/compiling testing cycle. Here is the last note I have from 10/14/2014:

"I've now installed the 4.33f version since I was unable to install 4.22. But, alas, it won't connect to my board."

So that is where I left off. Is this the same 4.33 version you mentioned above?

I'm venting a little so excuse me in advance (I knew what to expect going into this and I do develop software professionally) but this was a time consuming process back then and I know it isn't completed yet. I'm not sure if I have 100 hours to invest in simply getting a CNC controller to work. 

regards,
Michael
Group: DynoMotion Message: 13067 From: Moray Cuthill Date: 4/4/2016
Subject: Re: How to pick up where I left off...
I think we all need to vent occasionally.

Single slot is still not an option, and I doubt it ever will be.

$400 is expensive for an encoder. Just had a quick look at US Digital, and their rotary encoders appear to start around $75, but it still leaves the challenge of mounting it. My lathe uses an additional toothed belt, with the encoder mounted to the side of the spindle.
For something like a US Digital encoder, you'd have to make up some form of shaft and bearing assembly to mount the pulley and take the stresses of the belt/pulley, with the encoder mounted on the same shaft.

Actually, just done a quick search on eBay.com (I'm UK based, so not the best to ask about US suppliers!), and a search for Rotary Encoder threw up a few results. Something like http://www.ebay.com/itm/Encoder-400P-R-Incremental-Rotary-Encoder-AB-2-phase-6mm-Shaft-5V-24V-W-coupling-/231622140685 would work (I've just picked one at random, just to give you an idea of the type to look for)
Match that with a couple narrow toothed pulleys, a suitable bracket, and a belt, and you should have a reasonably priced solution. The belt and pulleys will most likely cost you more than the encoder.

Programming the KFlop to work, is just like any other programming. Break it down into small chunks, and tackle one at a time.
There are quite a few example files, but you'll probably want to start with one of the KStep specific ones. Use one to get your motors moving via KMotionCNC (or Mach3), then gradually add in the extra features you need, like spindle control, then a spindle encoder.

I'm just back in from finally getting my Tool Offsets setting program working on my lathe (I'm moving from Mach 3 to KMotionCNC), and it's a refreshing change from Mach3. I simply take a test cut, measure it, click the User Button to launch the setting program, enter the measured value, and the tool table offset is instantly updated.
I've just got a few final bugs to work out my spindle control code, and I'm good to go.

4.33f is many versions old! The final test/pre-release version was 4.33m IIRC.
The link to download 4.33 can be found at http://dynomotion.com/Software/Download.html along with a changelog if you want see what's changed since 4.33f.

If you're using a version of windows that uses digital driver signing, you may need to install 4.34a just for the drivers. If you do have problems with driver signing, have a read of this thread over on CNCZone - http://www.cnczone.com/forums/dynomotion-kflop-kanalog/291890-kflop-signature-driver-error-code052.html

Moray

On Mon, Apr 4, 2016 at 6:55 PM, mhackney@... [DynoMotion] <DynoMotion@yahoogroups.com> wrote:
 

Thanks Moray, it's the "suitable quadrature encoder" that was the primary issue. The only one I could find even close to my price range was over $400. And frankly, at that price I'm tempted to scrap the KFLOP and go a different direction. I found an email thread from Tom that said that they hadn't written code to work with a single pulse per revolution, has that been address now? If not, the solution was to use 2 photo transistors mounted 1/4 of a slot pitch apart. I don't have time or desire to design my own encoder from scratch, that is just not a good use of my time. If I had an encoder that is known to work (and not $$$) then I probably could pick it up from there. 


Other than that, the other source of friction was just the entire configuration/coding/compiling testing cycle. Here is the last note I have from 10/14/2014:

"I've now installed the 4.33f version since I was unable to install 4.22. But, alas, it won't connect to my board."

So that is where I left off. Is this the same 4.33 version you mentioned above?

I'm venting a little so excuse me in advance (I knew what to expect going into this and I do develop software professionally) but this was a time consuming process back then and I know it isn't completed yet. I'm not sure if I have 100 hours to invest in simply getting a CNC controller to work. 

regards,
Michael


Group: DynoMotion Message: 13068 From: mljh Date: 4/4/2016
Subject: Re: How to pick up where I left off...
Yeah, venting is therapeutic as long as it doesn't upset folks!

I've spent some time reacquainting myself with where I left off. I made copious notes so that was good. I also watched the excellent new KSTEP video on you tube https://www.youtube.com/watch?v=pW-9fDLAn2s that was just released in January. Very very helpful. A big part of the challenge on things like this are the number of ways of doing things. Even this video gets a bit difficult just talking about power supply inputs. Flexibility is fine for experienced users but for the first timer, it can be a curse.

I buy stuff from the UK all the time, so that isn't an issue if necessary. At this point the cost of letting this sit for another year is far greater than spending some reasonable amount of time and money to polish it off. I would prefer to do the encoder up front so I don't have to disassemble things later but it's looking like I just need to get the lathe operational with speed control and not worry about the encoder for threading. I looked at the US Digital encoders at one point. Part of the challenge was there is not a lot of room to add in a take off belt to drive the encoder - at least the way I'm doing the conversion. I planned to leave the original belt routing in place, which takes up a fair amount of room - to minimize having to fabricate a lot of stuff. But, maybe it's best just to bit the bullet and be done with it if I can find a way to mount the drive pulley for the takeoff.
 
Thanks for the link to the driver signing. I absolutely ran into that issue on Windows 7 so hopefully this will get me through that. 

I think what I need to do is put the control box/power supply together first and not worry about "options". Then take the steppers off my lathe so I can work with them upstairs in my office away from my nano-factory. It's a pain to do any programming in my shop and sitting in the comfort of my office might make the job go faster. I can set up my control PC upstairs too and have a self contained system to get started. Originally I tried to do all this in situ and that introduced a fair amount of pain in itself.

Cheers,
Michael
Group: DynoMotion Message: 13069 From: az@aimele.com Date: 4/5/2016
Subject: Re: How to pick up where I left off...
Hello,  I don't know where you have looked for an encoder or exactly what features you're looking for but Encoder Products company has a variety of encoders for about $150 if I'm not mistaken. I use Encoder products encoders on many applications and they are reliable with a quick delivery.  I've also found encoders on Ebay for less than $100 but I can't vouch for those.

Good Luck
AZ



Group: DynoMotion Message: 13070 From: mljh Date: 4/5/2016
Subject: Re: How to pick up where I left off...
Over a year ago I spent several weeks researching, talking to Tom and a couple of knowledgeable KFLOP users and quickly got lost in the weeds. That coupled with the install error at the time and many many other things going on, the project sat there. You know how it goes.

Anyway, the good news is I'm getting back up to speed. Thankfully I took great notes. The encoder Morray linked to is inexpensive and looks serviceable so I ordered one to try. I'll have to figure out how to rig it but even worse case I could use a friction wheel running against the main timing belt - at least temporarily to get things configured. Meanwhile, it's back to configuring the KFLOP/KSTEP and finishing off the control box to hold the power supply, eStop circuitry and KFLOP/KSTEP.

I moved the PC I'm using to control the lathe to my office so I can relax while working on this. I updated to Windows 10 (from 7) and I'm really pleased with the performance and usability. I'd already updated 4 other PCs so knew what to expect. 

Before I update I want to make sure I recover what I had previously done. So I launched KMOTION and have some questions.

I did not have the KFLOP/KSTEP hooked up via USB when I launched KMOTION. I do not see any of the configuration that I had previously done. There is no File->Load parameters so I'm guessing everything resides on KFLOP and if I connected it I would see what was loaded? Is there a way to save this type of config? I did find my C program - which I called user1 for some reason - and am able to load and compile it.

Before I upgrade KMOTION and the firmware I want to make sure I won't lose any past work - but first I need to make sure I defamiliarize myself with the past work.

Any recommendations? Can I upgrade without fear of losing my previous work? I am going to zip and save the entire dynomotion folder as a backup, I just want to know what to expect.

Michael

  
Group: DynoMotion Message: 13071 From: Tom Kerekes Date: 4/5/2016
Subject: Re: How to pick up where I left off...
Hi Michael,

Although possible to save parameters to KFLOP we don't recommend it.  We recommend to always leave KFLOP in a virgin state and let it be initialized by your KMotion.exe Screen settings or by your initialization C Program.  If you did flash parameter settings into a KFLOP they wouldn't necessarily appear in the KMotion.exe screens unless you upload the settings from KFLOP into the screens.

Settings in KMotion.exe screens persist from one run to the next because they are saved in a file \KMotion\Data\config.txt

KMotion.exe Screen Axis settings can also be loaded/saved as *.mot files.

KMotion.exe Screen Axis settings can also be imported from an initialization C Program that you have previously created.

This Flash video may help you understand:
http://dynomotion.com/Help/FlashHelp/Parameters/index.html

Its up to you to keep track of what you have changed and what files you have created and where you have saved them.

It might be better for you to start from scratch so you know what you have done.  Its not that hard once you know what you are doing.

HTH
Regards
TK

On 4/5/2016 7:15 AM, mhackney@... [DynoMotion] wrote:
 

Over a year ago I spent several weeks researching, talking to Tom and a couple of knowledgeable KFLOP users and quickly got lost in the weeds. That coupled with the install error at the time and many many other things going on, the project sat there. You know how it goes.


Anyway, the good news is I'm getting back up to speed. Thankfully I took great notes. The encoder Morray linked to is inexpensive and looks serviceable so I ordered one to try. I'll have to figure out how to rig it but even worse case I could use a friction wheel running against the main timing belt - at least temporarily to get things configured. Meanwhile, it's back to configuring the KFLOP/KSTEP and finishing off the control box to hold the power supply, eStop circuitry and KFLOP/KSTEP.

I moved the PC I'm using to control the lathe to my office so I can relax while working on this. I updated to Windows 10 (from 7) and I'm really pleased with the performance and usability. I'd already updated 4 other PCs so knew what to expect. 

Before I update I want to make sure I recover what I had previously done. So I launched KMOTION and have some questions.

I did not have the KFLOP/KSTEP hooked up via USB when I launched KMOTION. I do not see any of the configuration that I had previously done. There is no File->Load parameters so I'm guessing everything resides on KFLOP and if I connected it I would see what was loaded? Is there a way to save this type of config? I did find my C program - which I called user1 for some reason - and am able to load and compile it.

Before I upgrade KMOTION and the firmware I want to make sure I won't lose any past work - but first I need to make sure I defamiliarize myself with the past work.

Any recommendations? Can I upgrade without fear of losing my previous work? I am going to zip and save the entire dynomotion folder as a backup, I just want to know what to expect.

Michael

  

Group: DynoMotion Message: 13072 From: mljh Date: 4/5/2016
Subject: Re: How to pick up where I left off...
Thanks Tom. That's the fact of the matter "it's not that hard once you know what you are doing!" It's getting to know what you are doing that's the painful part!
Group: DynoMotion Message: 13074 From: mljh Date: 4/5/2016
Subject: Re: How to pick up where I left off...
Thanks Tom, the flash video was helpful. I remember watching that before.

So I was able to load the screens and retrieve where I left off. I have my original - albeit very simplistic - C program and I'm able to run it. At this point I'm going to update KMOTION and firmware and start from scratch.
Group: DynoMotion Message: 13078 From: mljh Date: 4/5/2016
Subject: Re: How to pick up where I left off...
And the pain picks up where I left off unfortunately.

I tested with the older release & firmware and verified my C program was loading and running - I see a welcome message printed on the console.

I then updated to the latest 4.33 software and firmware and again test to verify my C program loads and runs. All good so far.

Then, I get Windows 10 into some funky state where keypresses like S popup the search panel. The keyboard would not allow me to edit the C program and certain characters would do system things and others like W would enter properly. I disabled all the ease of access stuff but that did not make any difference. So I rebooted.

And now, although KMOTION connects to my KFLOP, the program compiles and seemingly uploads, I am not seeing my welcome message printed. I can turn on and off the LEDs from the console with SetBit:46 and 47 and ClearBit. So I know I have connected. I uploaded my program to thread 1. 

While I'm here... I also noticed that if I issue Reboot! from the console, the KFLOP reboots but will not reconnect. I get an error dialog. I have to unplug USB cable to get a connection. Any info on that greatly appreciated.

Next, what is the consensus/general wisdom on how to configure the Z and X axis for a lathe? I had Channel 0 as my Z and 1 as my X but should check now before I found out that I should have done it differently.

Also, should all of the unused channels inputs and outputs be set to "no ..."? So I would only have 2 active channels, presumably 0 and 1?

thanks,
Michael 
Group: DynoMotion Message: 13079 From: Moray Cuthill Date: 4/5/2016
Subject: Re: How to pick up where I left off...
I can't really comment about the strange windows/keyboard problem.
Does Win10 have some form of sticky keys that could be the problem? Or even something simpler like a sticky/faulty key on your keyboard?

If you open the console window, and send 'Version', do you get a status/version message displayed from the KFlop?
There was an issue with the Reboot command, however I thought that it had been fixed. It's not a command you would use under normal circumstances, as it's usually easier to just cycle the power.

You configure the X and Z as you would any other machine.
The DefineCoordSystem() function, requires 4 parameters, which must be in the order X,Y,Z,A.
Any unused axis should be set to -1, so for your lathe with Z on channel 0, and X on channel 1 you should have something like-
DefineCoordSystem(1,-1,0,-1);

Moray

On Tue, Apr 5, 2016 at 10:19 PM, mhackney@... [DynoMotion] <DynoMotion@yahoogroups.com> wrote:
 

And the pain picks up where I left off unfortunately.


I tested with the older release & firmware and verified my C program was loading and running - I see a welcome message printed on the console.

I then updated to the latest 4.33 software and firmware and again test to verify my C program loads and runs. All good so far.

Then, I get Windows 10 into some funky state where keypresses like S popup the search panel. The keyboard would not allow me to edit the C program and certain characters would do system things and others like W would enter properly. I disabled all the ease of access stuff but that did not make any difference. So I rebooted.

And now, although KMOTION connects to my KFLOP, the program compiles and seemingly uploads, I am not seeing my welcome message printed. I can turn on and off the LEDs from the console with SetBit:46 and 47 and ClearBit. So I know I have connected. I uploaded my program to thread 1. 

While I'm here... I also noticed that if I issue Reboot! from the console, the KFLOP reboots but will not reconnect. I get an error dialog. I have to unplug USB cable to get a connection. Any info on that greatly appreciated.

Next, what is the consensus/general wisdom on how to configure the Z and X axis for a lathe? I had Channel 0 as my Z and 1 as my X but should check now before I found out that I should have done it differently.

Also, should all of the unused channels inputs and outputs be set to "no ..."? So I would only have 2 active channels, presumably 0 and 1?

thanks,
Michael 


Group: DynoMotion Message: 13080 From: mljh Date: 4/5/2016
Subject: Re: How to pick up where I left off...
Yes, I get a version string that is correct.

I'm really surprised there is not a KSTEP initkstep2axis.c program. Did you start with the 3xis and remove stuff, write one from scratch or something else? I think at this point I'll just focus on getting the 2 axis to work and not attempt the spindle speed control, encoder or end stops. I just want to see if I can get something working as a baseline. 
Group: DynoMotion Message: 13081 From: Moray Cuthill Date: 4/5/2016
Subject: Re: How to pick up where I left off...
If Version is working, then the KFlop is connected and working correctly.
One possible catch is printf statements only get transmitted/displayed once a newline character (\n) is added. If you don't have a newline character, then everything simply gets held in a buffer.


I usually start with one of the example files, then remove/add what I need.

I'd recommend starting with the InitKStep3AxisNoDisable example, delete the ch2 stuff, and modify the DefineCoordSystem to suit.
Use that to get your axis motors spinning, then work on the other features.
Spindle speed control is probably one of the more advanced things to implement, but if you tell us what kind of spindle control you'll be using, we can point you in the right direction.

Moray

On Tue, Apr 5, 2016 at 11:30 PM, mhackney@... [DynoMotion] <DynoMotion@yahoogroups.com> wrote:
 

Yes, I get a version string that is correct.


I'm really surprised there is not a KSTEP initkstep2axis.c program. Did you start with the 3xis and remove stuff, write one from scratch or something else? I think at this point I'll just focus on getting the 2 axis to work and not attempt the spindle speed control, encoder or end stops. I just want to see if I can get something working as a baseline. 


Group: DynoMotion Message: 13082 From: mljh Date: 4/5/2016
Subject: Re: How to pick up where I left off...
Here's the code:

printf("G0602 Lathe\n");

and this was working fine last year and earlier today. Now it isn't I've cleared the KFLOP and reuploaded the program and it does not seem to be calling this main at all. Yet I know I'm connected to the board.

Ok, thanks. I'll start with the 3 axis and go from there. 

I'm using a Teco 115C in/220 3 Phase out VFD. # JNEV-101-H1  Here's the manual for it: http://dealerselectric.com/images/Products/teco/ev_installation.pdf

A number of folks on the CNCZone have used this for their lathes and mills (of course, using Mach3). I remember researching it. Speed control is shown on page 6 - basically 0-10VDC.
 
Group: DynoMotion Message: 13085 From: mljh Date: 4/6/2016
Subject: Re: How to pick up where I left off...
Ok, so I started with the 3 axis KSTEP sample, removed channel 2 (keeping 0 and 1), reorganized the axes for the lathe (Z = channel 0, X = channel 1), etc. I added the same printf line at the top of the main(), compiled, uploaded and ran. Still no message printed. Version returns the correct firmware version, ClearBit:47 turns off the correct LED on the board.  Thread 1 is selected in the program window. 

When I download the program how do I know that 1) it is downloading and 2) when it has completed successfully? I don't see any blinking LEDs or anything in the program window providing download feedback. I have verified that compiling is working - inserting a rogue character generates an error. Even the 6 arrow "compile->download->run" button doesn't seem to upload the program.

I don't have steppers hooked up yet as I wanted to understand the basics before doing that. The printf should tell me that the compile-upload-run cycle is working properly. Up until yesterday it worked fine.
Group: DynoMotion Message: 13086 From: mljh Date: 4/6/2016
Subject: Re: How to pick up where I left off...
One last try. I copied and pasted the simple Hello World from the wiki and get nada. Even power cycling does not print Hello World. Version from the console gives the version info, the KFLOP is connected. No compile errors. Can't tell if the program downloads as per my previous post.
Group: DynoMotion Message: 13089 From: Tom Kerekes Date: 4/6/2016
Subject: Re: How to pick up where I left off...
Hi Michael,

Power cycling won't execute programs unless they have been Flashed into KFLOP Memory and Configured to "Launch on Power up".

Strange you are having so much trouble with all the basics.  I can't think of why something so simple wouldn't work unless you are doing something strange like mixing versions, or have flashed programs to KFLOP, or have multiple Versions running.

So I would suggest first making sure KFLOP is restored to defaults with:

#1 Turn off KFLOP Power
#2 Reboot PC
#3 Run \KMotion433\Release\KMotion.exe
#4 Turn on KFLOP
#5 Use Config\Flash Screen to Flash "New Version"
#6 Exit KMotion.exe
#7 Turn off KFLOP Power

Now test executing a program to print to Console

#1 Run \KMotion433\Release\KMotion.exe
#2 Turn On KFLOP
#3 Open Console Screen
#4 Enter "Version" Verify Firmware Version is V4.33
#5 Open C Programs Screen
#6 Select Thread #1
#7 Open file "print.c"
#8 Push Save/Compile/Download/Run (button with 6 arrows)
#9 Check if "Hello World" is printed on the Console Screen

HTH
Regards
TK



On 4/6/2016 8:39 AM, mhackney@... [DynoMotion] wrote:
 

One last try. I copied and pasted the simple Hello World from the wiki and get nada. Even power cycling does not print Hello World. Version from the console gives the version info, the KFLOP is connected. No compile errors. Can't tell if the program downloads as per my previous post.


Group: DynoMotion Message: 13090 From: mljh Date: 4/6/2016
Subject: Re: How to pick up where I left off...
Thanks Tom. I understand about flashing and had actually also tested by power cycling after flashing. I think I'm just cursed, maybe I upset the M*** gods when they caught wind I'm using KFLOP?

So, I unplugged KFLOP, rebooted my PC, ran KMotion, plugged in KFLOP, flashed new version and then shut everything down and restarted everything. I then tested the simple Hello World and that worked this time. I then compiled my work-in-progress 2 axis init program with a printf in it and that also works.

I forgot to mention. I did see the radio button on the program window turn green when I clicked Run. I am seeing that now too and things seem to be working fine.

So at this point I think I have a 2 axis (Z & X) init for the lathe basically configured. I need to finish the electronics box so I can actually test and tune the motors and steps/in on the lathe. This is as bare bones as it gets, 2 stepper motor control, no home or end switches, no spindle control and no eStop. I do have the eStop circuitry wiring in progress but I won't interface it to KFLOP until I get the thing running 2 steppers. 
Group: DynoMotion Message: 13091 From: Moray Cuthill Date: 4/6/2016
Subject: Re: How to pick up where I left off...
Sounds like you've managed the first step.

The thread number turning green indicates there is a program running within that thread, however you need to be aware that the program currently running, may not be the same as the program being displayed for that thread.

Once you have a program running in a thread, you can then load another file, and the original program will continue to run in the KFlop until you Download and Run the currently displayed program.
It's the same if you launch a program via KMotionCNC. KMotionCNC will load whatever C program KMotionCNC is set to load, into the thread KMotionCNC is set to load the program, completely independently of what C program is currently displayed in the KMotion C Program window for that thread.

Moray

On Wed, Apr 6, 2016 at 5:40 PM, mhackney@... [DynoMotion] <DynoMotion@yahoogroups.com> wrote:
 

Thanks Tom. I understand about flashing and had actually also tested by power cycling after flashing. I think I'm just cursed, maybe I upset the M*** gods when they caught wind I'm using KFLOP?


So, I unplugged KFLOP, rebooted my PC, ran KMotion, plugged in KFLOP, flashed new version and then shut everything down and restarted everything. I then tested the simple Hello World and that worked this time. I then compiled my work-in-progress 2 axis init program with a printf in it and that also works.

I forgot to mention. I did see the radio button on the program window turn green when I clicked Run. I am seeing that now too and things seem to be working fine.

So at this point I think I have a 2 axis (Z & X) init for the lathe basically configured. I need to finish the electronics box so I can actually test and tune the motors and steps/in on the lathe. This is as bare bones as it gets, 2 stepper motor control, no home or end switches, no spindle control and no eStop. I do have the eStop circuitry wiring in progress but I won't interface it to KFLOP until I get the thing running 2 steppers. 


Group: DynoMotion Message: 13092 From: mljh Date: 4/6/2016
Subject: Re: How to pick up where I left off...
Next up...

Now that I seemingly have the program uploading, I wanted to see how to go about determining which connector on KSTEP is used for Channel 0 and 1 (my Z and X stepper motors in that order). I opened the digital I/O screen KFLOP tab and I see some - I think - odd behavior. The state bits for 2 Enc 1 A and 3 Enc 1 B are flickering checked/unchecked. I can not uncheck the output box. The 8, 9, 19, 11 home are also all set as output although I've explicitly not configured home switches. None of the state bits are set on the KSTEP tab. 

Here's a screen shot of what I see. 


  @@attachment@@
Group: DynoMotion Message: 13093 From: mljh Date: 4/6/2016
Subject: Re: How to pick up where I left off...
Thanks Moray, I understand that about the source you see is not running until you explicitly upload it and run it. I have not even launched KMotionCNC yet! 

But as you might see on the post I made while you were posting this, I think I'm seeing some additional odd behavior on just the basic 2 axis stepper control with nothing else configured.
Group: DynoMotion Message: 13094 From: Moray Cuthill Date: 4/6/2016
Subject: Re: How to pick up where I left off... [1 Attachment]
That sounds perfectly normal.
When you connect and configure add-on boards to a KFlop, certain KFlop inputs/outputs are used to control the add-on board (in your case the KStep).
If you look at the Hardware/Connector page for the KFlop, you'll most likely find all those Bits you've listed relate to the connector that the KStep is using.

As for the KStep State Bits, they'll not show ticked unless you apply the required power to the input pins on JP33.

The details for all the connectors can be found on the main Dynomotion Help Contents/index page, either at http://www.dynomotion.com/Help/ or via the Help menu within KMotion (or by clicking help from any KMotion/KMotionCNC window, then Home)

Moray

On Wed, Apr 6, 2016 at 6:49 PM, mhackney@... [DynoMotion] <DynoMotion@yahoogroups.com> wrote:
 
[Attachment(s) from mhackney@... [DynoMotion] included below]

Next up...


Now that I seemingly have the program uploading, I wanted to see how to go about determining which connector on KSTEP is used for Channel 0 and 1 (my Z and X stepper motors in that order). I opened the digital I/O screen KFLOP tab and I see some - I think - odd behavior. The state bits for 2 Enc 1 A and 3 Enc 1 B are flickering checked/unchecked. I can not uncheck the output box. The 8, 9, 19, 11 home are also all set as output although I've explicitly not configured home switches. None of the state bits are set on the KSTEP tab. 

Here's a screen shot of what I see. 



Group: DynoMotion Message: 13103 From: mljh Date: 4/6/2016
Subject: Re: How to pick up where I left off...
I've decided to hook up a small test bed in my office (like in Tom's video) while I complete assembly of my control box. Basically, this consists of 2 small NEMA 17 steppers (<1A) and a 12V DC power supply. My goal is to hook these up and get them to run lathe gcode. I want to sanity check everything so I don't release the magic smoke. I've annotated my questions in bold.


Since my steppers are <1A I do not need any current setting jumpers.
I have all 3 jumpers on the voltage clamp pins ABC.
I am using steppers that I use on my 3D printers and have verified the coils. These are hooked up to J2 (motor 0 which will be my Z axis) and J3 (motor 1 which will be my X axis).

Currently I have the jumper on J3 on the KFLOP so I could test with USB power - this was before setting this test bed up. First question, since I am going to provide power through the KSTEP J1, I need to leave that jumper in place and power the board from USB, correct? The 12VDC supply will be connected to J1 on the KSTEP. I assume that I can use either GND and either VB terminal on the four terminal, is that correct? (why are there 2 sets of terminals on J1?)

The isolation jumpers are installed on JP34 and JP35 since I'm powering the board from USB.

I think that's everything. I'll wait for verification that this is correct before powering up as my luck to date has been on the "bad" side!

Group: DynoMotion Message: 13104 From: Tom Kerekes Date: 4/6/2016
Subject: Re: How to pick up where I left off...
Hi Michael,

That all sounds correct.  Although when you use the word "power" you might be specific about what power you are referring to.

Install KFLOP USB jumper J3 and KSTEP Isolation jumpers JP34 and JP35 to supply both KFLOP and KSTEP +5V from USB. 

Yes you can use either GND or VB terminals on KSTEP J1.  If your total current is more than 10Amps use both connections.  It is not in your case.

HTH
Regards
TK

On 4/6/2016 5:54 PM, mhackney@... [DynoMotion] wrote:
 

I've decided to hook up a small test bed in my office (like in Tom's video) while I complete assembly of my control box. Basically, this consists of 2 small NEMA 17 steppers (<1A) and a 12V DC power supply. My goal is to hook these up and get them to run lathe gcode. I want to sanity check everything so I don't release the magic smoke. I've annotated my questions in bold.



Since my steppers are <1A I do not need any current setting jumpers.
I have all 3 jumpers on the voltage clamp pins ABC.
I am using steppers that I use on my 3D printers and have verified the coils. These are hooked up to J2 (motor 0 which will be my Z axis) and J3 (motor 1 which will be my X axis).

Currently I have the jumper on J3 on the KFLOP so I could test with USB power - this was before setting this test bed up. First question, since I am going to provide power through the KSTEP J1, I need to leave that jumper in place and power the board from USB, correct? The 12VDC supply will be connected to J1 on the KSTEP. I assume that I can use either GND and either VB terminal on the four terminal, is that correct? (why are there 2 sets of terminals on J1?)

The isolation jumpers are installed on JP34 and JP35 since I'm powering the board from USB.

I think that's everything. I'll wait for verification that this is correct before powering up as my luck to date has been on the "bad" side!


Group: DynoMotion Message: 13107 From: mljh Date: 4/7/2016
Subject: Re: How to pick up where I left off...
This is much like that old Three Stooges episode...


I hooked everything up, double checked, triple checked and then muttered a few incantations to the CNC deities. 

Then I opened KMotion and followed along with the KSTEP Introduction video. '

Channel 0 stepper moving nicely.
Channel 1 stepper moving nicely. 

I then loaded the sample InitKSTEP3Axis.c program and carefully edited it to create a 2 axis version and defined my coordinate system:

DefineCoordSysem(1, -1, 0, -1);

I saved and test compiled the program to make sure there were no compile errors. The next step in the video is to open KMotionCNC and go to Tool Setup to point to my new init program. 

I click Init and see X and Z DROs turn green, Y is yellow (as I would expect). Great! I can jog X and Z and the correct stepper moves. This is all looking good. Now I need some 2 axis (X-Z) lathe gcode to test. I didn't see any samples in the GCode folder so I edited the circleXY_XZ_YZ.ngc to create a simple test:
G20
F12
G0 X0 Z0
G18
G2 Y0 Z0 I0 K1.0
M2
and I'm getting what looks to be correct coordinated motion and the G Code Viewer is showing a circle in the XZ axis view. Things are looking good with the basic 2 axis control. 

I haven't spent time with KMotionCNC in the past so now I need to get up to speed with that over the next few days while I work on my control box. Is it configurable to create a basic lathe screen or does that require VisualStudio programming?


 
 
  @@attachment@@
Group: DynoMotion Message: 13108 From: mljh Date: 4/7/2016
Subject: Re: How to pick up where I left off...
Ok, found the screen "faces" drop down in tool setup. I'll go quiet now and read help and the wiki before asking pesky questions!
Group: DynoMotion Message: 13112 From: mljh Date: 4/7/2016
Subject: Re: How to pick up where I left off...
Ok, I'm back! I spent a bit of time reading a lot of docs and experimenting but I have a persistnant issue I don't understand and can't seem to change. The issue is that in KMotionCNC the X axis DRO updates when I jog the with the Z jog buttons and vice versa. So I stepped back and reconfigured things like this:

J2 connector will be my X axis on Channel 0 -> Output Channel 8
J3 connector will be my Z axis on Channel 1 -> Output Channel 9

I updated the C program after making these changes and verified they "stuck". I then edited the coordinate system to (0, -1, 1, -1). Saved/Compiled/Uploaded/Run. 

Then I launched KMotionCNC, clicked the Init button (the edited program is the same name and in same location) and jogged. I have the lathe 2 axis screen installed. Clicking the Z axis jog buttons cause my X stepper (J2 connector, Channel 0) to move but the X DRO is updated on screen. The opposite occurs when I click the X jog buttons.

So it seems I that the steppers and DROs are correct but the axes jog buttons are not. 

I then tried swapping the coordinate system to (1, -1, 0, -1) and tested. Now, the Z jog button jogs the stepper on KSTEP connector J3 (what I want to be my Z axes) but the X axes DRO is still updated. I must be overlooking some detail.
Group: DynoMotion Message: 13118 From: mljh Date: 4/8/2016
Subject: Re: How to pick up where I left off...
It turns out that there is a checkbox on the Tool Setup->Trajectory Planner tab in the Lathe Options box called Lathe. Check that and all is well. A google search found it: http://www.dynomotion.com/Help/KMotionCNC/ToolSetupScreenTP.htm

Now I'm off to the races. I'm working on my eStop routine and have a basic estop handler implemented (simple). The questions I have now are around best practices with KSTEP and KFLOP for doing things like:

1) estop handling
2) HOME handling
2) using the KSTEP relays drivers (for coolant, etc)
3) using the KSTEP analog out for VFD spindle control 


Are there any published real world examples of these?


I've looked through the sample code and that has been helpful. I assume that the simple samples that demonstrate something in a while{} in a simple main can just be taken and put into my program's while{} or is the intent that these are run in individual threads?

Group: DynoMotion Message: 13127 From: Moray Cuthill Date: 4/9/2016
Subject: Re: How to pick up where I left off...
Hi Michael,

for my KStep powered probing machine/CMM, I have the E-stop simply wired to kill power to the stepper power supply (basic toroidal/bridge rectifier/capacitor setup), and also tied in to a KStep input so the KFlop gets notified.
The E-stop handling code in the KFlop then kills the KStep enable.
However on a larger machine that could be a problem, as simply disabling the KStep could allow the steppers to freewheel, which could potentially be quite dangerous. It would probably be wiser to have the E-Stop handler bring any motion to a stop before removing the enable. My machine is based on a Chinese 3040 machine, so it's not got enough weight or power to do much damage.

Homing can be handled however you like. Basic system is usually move into a home switch until it triggers, then slowly back of until it untriggers, at which point the axis positions typically get zeroed. You can potentially use limit switches for homing, but that means not having them trigger a hard e-stop (I personally cringe at the thought of limit switches not cutting all motion power directly, but on small machines it's probably not that major an issue).

Basic outputs are easy to handle. In KMotionCNC, in Tool Setup, use the I/O Bit option against the relevant M Codes.
VFD control can be a bit harder than it first appears, depending on what you'd like to achieve.
Basic output can be handled with the 0-10V, however as you'll be using an encoder, it does give you an option to run closed loop for precise speed control, but if you want to run in reverse, it's a bit more involved as you need to create a custom output for the spindle channel.

Moray

On Fri, Apr 8, 2016 at 8:59 PM, mhackney@... [DynoMotion] <DynoMotion@yahoogroups.com> wrote:
 

It turns out that there is a checkbox on the Tool Setup->Trajectory Planner tab in the Lathe Options box called Lathe. Check that and all is well. A google search found it: http://www.dynomotion.com/Help/KMotionCNC/ToolSetupScreenTP.htm


Now I'm off to the races. I'm working on my eStop routine and have a basic estop handler implemented (simple). The questions I have now are around best practices with KSTEP and KFLOP for doing things like:

1) estop handling
2) HOME handling
2) using the KSTEP relays drivers (for coolant, etc)
3) using the KSTEP analog out for VFD spindle control 


Are there any published real world examples of these?


I've looked through the sample code and that has been helpful. I assume that the simple samples that demonstrate something in a while{} in a simple main can just be taken and put into my program's while{} or is the intent that these are run in individual threads?


Group: DynoMotion Message: 13128 From: Tom Kerekes Date: 4/9/2016
Subject: Re: How to pick up where I left off...
Hi Michael,

#1 Estop is a complex subject with many possibilities.  Please research the forums

#2 See the SimpleHomeIndexFunctionTest.c example

#3 assign associated I/O bit to M Codes

#4 See  Analog Output Section here:
http://dynomotion.com/Help/SchematicsKStep/UsingKStep.htm

See the example: \C Programs\KStep\KMotionCNC\Spindle_S_Kstep.c

HTH
Regards
TK

On 4/8/2016 12:59 PM, mhackney@... [DynoMotion] wrote:
 

It turns out that there is a checkbox on the Tool Setup->Trajectory Planner tab in the Lathe Options box called Lathe. Check that and all is well. A google search found it: http://www.dynomotion.com/Help/KMotionCNC/ToolSetupScreenTP.htm


Now I'm off to the races. I'm working on my eStop routine and have a basic estop handler implemented (simple). The questions I have now are around best practices with KSTEP and KFLOP for doing things like:

1) estop handling
2) HOME handling
2) using the KSTEP relays drivers (for coolant, etc)
3) using the KSTEP analog out for VFD spindle control 


Are there any published real world examples of these?


I've looked through the sample code and that has been helpful. I assume that the simple samples that demonstrate something in a while{} in a simple main can just be taken and put into my program's while{} or is the intent that these are run in individual threads?


Group: DynoMotion Message: 13130 From: mljh Date: 4/9/2016
Subject: Re: How to pick up where I left off...
Thanks Moray. Actually, I guess I didn't ask my question clearly enough! I've built 5 CNC machines (mills and a router) and 8 3D printers. The mills at least all have good eStop handling, etc. What I meant to ask was what are some best programming practices in KMotion for these tasks? My machines are not huge production floor machines. The lathe I'm working on is a Grizzly G0602 conversion (a 10" x 22" lathe).

To start, I'll run the VFD open loop and deal with the encoder once I have the basic lathe functional. I rarely ever run the lathe in reverse so I can leave that as a future project too. I'm actually pretty close with the program now - at least with testing on my desktop. 

So, for specifics, you mention a few good points on the eStop. What is a recommended/best practice for implementing that in software? Something like this:

In my main for(ever) loop, ReadBit the digital IO I'm using for eStop indication. This is actually wired into 3 physical eStop buttons strategically placed around the lathe as well as the limit switches. So any one of these activates and I process it as an eStop.

If I detect the eStop in the for(ever) loop, I call my eStop handler function. It currently calls DisableAxis for each Enabled channel. Currently that is channel 0 (X axis) and 1 (Z axis) but ultimately would include the spindle I would imagine. Once the axes are disabled, I kill the KSTEP enable (ClearBit 45 correct?). 

Is it that simple or is there more I should be doing? That's the level of detail I'm trying to understand.

Cheers,
Michael

Group: DynoMotion Message: 13131 From: Moray Cuthill Date: 4/9/2016
Subject: Re: How to pick up where I left off...
I'm not sure how KStep deals with disabled channels, but I think it'll simply stop all movement abruptly and keep power applied to the motors.

You could add a delay before the KStep enable signal is removed after an estop, so the KStep can physically stop the motors, otherwise you leave the potential for them to continue freewheeling when the KStep is disabled. However, you'd have to weigh up the pros and cons of doing that.

The big issue with lathes, is bad things have usually happened long before an E-stop is handled. I know on my lathe, the only use the Z-axis limit switches have, is to stop the Z-axis guards getting damaged. The turret will be bouncing of the chuck long before a limit switch is reached, and usually long before you get a chance to hit the E-stop even when your stood watching the turret launch towards the spindle after entering the wrong code!

Moray


On Sat, Apr 9, 2016 at 10:02 PM, mhackney@... [DynoMotion] <DynoMotion@yahoogroups.com> wrote:
 

Thanks Moray. Actually, I guess I didn't ask my question clearly enough! I've built 5 CNC machines (mills and a router) and 8 3D printers. The mills at least all have good eStop handling, etc. What I meant to ask was what are some best programming practices in KMotion for these tasks? My machines are not huge production floor machines. The lathe I'm working on is a Grizzly G0602 conversion (a 10" x 22" lathe).


To start, I'll run the VFD open loop and deal with the encoder once I have the basic lathe functional. I rarely ever run the lathe in reverse so I can leave that as a future project too. I'm actually pretty close with the program now - at least with testing on my desktop. 

So, for specifics, you mention a few good points on the eStop. What is a recommended/best practice for implementing that in software? Something like this:

In my main for(ever) loop, ReadBit the digital IO I'm using for eStop indication. This is actually wired into 3 physical eStop buttons strategically placed around the lathe as well as the limit switches. So any one of these activates and I process it as an eStop.

If I detect the eStop in the for(ever) loop, I call my eStop handler function. It currently calls DisableAxis for each Enabled channel. Currently that is channel 0 (X axis) and 1 (Z axis) but ultimately would include the spindle I would imagine. Once the axes are disabled, I kill the KSTEP enable (ClearBit 45 correct?). 

Is it that simple or is there more I should be doing? That's the level of detail I'm trying to understand.

Cheers,
Michael